/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package basan.core;

import basan.components.RenderBoxComponent;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;

/**
 *
 * @author Menno @ Basans
 */
public class EntityFactory {
    
    private static EntityContainer entityContainer;
    private static World world = null;
    
    protected EntityFactory() {
        entityContainer = EntityContainer.getInstance();
    }
    
    protected void setWorld(World world) {
        EntityFactory.world = world;
    }
    
    protected GameObject createGameObject() {
        GameObject o = new GameObject();
        entityContainer.addEntity(o);
        return o;
    }
    
    protected GameObject createGameObject(float x, float y, float z) {
        GameObject o = new GameObject(x, y, z);
        entityContainer.addEntity(o);
        return o;
    }
    
    protected GameObject createRenderableGameObject() {
        GameObject o = new GameObject();
        
        RenderBoxComponent comp = new RenderBoxComponent(o, "box");
        o.addComponent(comp);
        world.addObject(comp.get3DObject());
        entityContainer.addEntity(o);
        return o;       
    }
    
    protected GameObject createRenderableGameObject(float x, float y, float z) {
        GameObject o = new GameObject(x, y, z);       
        RenderBoxComponent comp = new RenderBoxComponent(o, "box");
        o.addComponent(comp);
        world.addObject(comp.get3DObject());
        entityContainer.addEntity(o);
        return o;       
    }
}
